<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/amazeui.min.css" />
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/hy.admin.css" />
	</head>

	<body>
		{include file='../Common/hy_header.html'}
		<div class="am-g">
			<div class="am-tabs am-margin" data-am-tabs="">
				<ul class="am-tabs-nav am-nav am-nav-tabs">
					<!-- <li class="am-active"><a hidefocus="true" href="#tab1">基本详情</a>
					</li>
					<li class="" ><a hidefocus="true" href="#tab3">SEO 选项</a>
					</li> -->
				</ul>

				<div class="am-tabs-bd am-form" style="touch-action: pan-y; -webkit-user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);">

					<div class="am-tab-panel am-fade am-active am-in" id="tab1">
						
						<div class="am-g am-margin-top">
							<div class="am-u-sm-2 am-text-right">
								奖品名称
							</div>
							<div class="am-u-sm-4 am-u-end">
								<input type="text" id="prize_name" value="{$res.prize_name}" class="am-input-sm">
							</div>
						</div>
						
						<div class="am-g am-margin-top">
							<div class="am-u-sm-2 am-text-right">
								备注
							</div>
							<div class="am-u-sm-4 am-u-end">
								<input type="text" id="mark" value="{$res.mark}" placeholder="奖品介绍" class="am-input-sm">
							</div>
						</div>
						
						<div class="am-g am-margin-top">
							<div class="am-u-sm-2 am-text-right">
								中奖概率
							</div>
							<div class="am-u-sm-4 am-u-end">
								<input type="text" id="pby" value="{$res.pby}" placeholder="输入1~100以内的整数" class="am-input-sm">
							</div>
						</div>
						
						<div class="am-g am-margin-top">
							<div class="am-u-sm-2 am-text-right">
								中奖优先级
							</div>
							<div class="am-u-sm-4 am-u-end">
								<input type="text" id="pri" value="{$res.pri}" placeholder="请输入正整数" class="am-input-sm">
							</div>
						</div>

						<div class="am-g am-margin-top">
							<div class="am-u-sm-2 am-text-right">
								卡券ID
							</div>
							<div class="am-u-sm-4 am-u-end">
								<input type="text" id="card_id" value="{$res.card_id}" placeholder="若多张卡券请用英文逗号隔开" class="am-input-sm">
							</div>
						</div>
						
						<div class="am-g am-margin-top">
						<div class="am-u-sm-2 am-text-right">
								卡券类型
						</div>
						<div class="am-u-sm-4 am-u-end">
							<input type="radio" checked="checked" name="card_type" value="0" > 长隆
						</div>
						</div>
					
								<input type="hidden" id="shd" value="{$res.id}" placeholder="" >
						
						<div class="am-margin" style="margin-left:25%;">
							<button type="button" onclick="submit()" class="am-btn am-btn-primary am-btn-xs">提交保存</button>
						</div>

					
				</div>
				
			</div>
		</div>
		<div class="hy-footer">

		</div>
		{include file='../Common/hy_footer.html'}
		<script type="text/javascript" src="{$_C.hy_path}js/editor/kindeditor.js"></script>
		<script type="text/javascript">
			function submit()
			{
				if($("#prize_name").val()=='')
				{
					showMsg('奖品名称不能为空',1);
					return;
				}
				if($("#pby").val()=='')
				{
					showMsg('中奖概率不能为空',1);
					return;
				}
				
				if($("#pri").val()=='')
				{
					showMsg('中奖优先级不能为空',1);
					return;
				}
				if($("#card_id").val()=='')
				{
					showMsg('卡券id不能为空',1);
					return;
				}
				
				$.ajax({
					type:"POST",
					url:"index.php?g=admin&m=long&a=set_prize",
					data:{
						id:$("#shd").val(),
						prize_name:$("#prize_name").val(),
						mark:$("#mark").val(),
						pby:$("#pby").val(),
						pri:$("#pri").val(),
						card_id:$("#card_id").val(),
						card_type:$("input[name=card_type]:checked").val(),
					},
					dataType:"json",
					success:function(data){
						if(data.error == 1){
							showMsg(data.content,1);
						}
						else{
							showMsg(data.content,0);
							parent.$('#longadminlist').attr('src', parent.$('#longadminlist').attr('src'));
							var tab_li = parent.$(".am-active");
							if(tab_li.prev().length>0)
							{
								tab_li.prev().addClass('am-active');
								var id=tab_li.prev().attr('data-id');
						        parent.$('#'+id).show();
							}
							else if(tab_li.next().length>0)
							{
								tab_li.next().addClass('am-active');
								var id=tab_li.next().attr('data-id');
						        parent.$('#'+id).show();
							}
							else
							{
								var tab='<li data-id="index" class="am-active"><a  href="javascript:;"><span class="hy-tabs-title">首页</span><span class="am-icon-close"></span></a></li>'
							    parent.$('.hy-tabs .am-nav').append(tab);
							    var iframe='<iframe onload="javascript:hy_loading()" id="index" src="index.php?g=admin&m=index&a=main" width="100%" height="100%"></iframe>';
							    parent.$('.hy-iframe').append(iframe);
							}
							var id=tab_li.attr('data-id');
							tab_li.remove();
							parent.$("#"+id).remove();
						}
					},
					error:function(){
						
					}
				});
			}
		</script>
	</body>

</html>